package com.yitong.blk.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.yitong.blk.domain.TestUser;
import com.yitong.blk.services.TestUserService;

@RestController
@RequestMapping("/blk")
public class TestUserController {
	
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	TestUserService testUserService;

	@ResponseBody
	@RequestMapping(value="/getTestUser")
	public String getTestUser(String name) {
		logger.info("user controller..."+name);
		TestUser test=testUserService.findTestByName(name);
		return JSON.toJSONString(test);
	}
	
	@ResponseBody
	@RequestMapping(value="/getTestUserPageList")
	public String getTestUserPage(String nextPage,String pageSize) {
		logger.info("user page controller..."+nextPage+"|"+pageSize);
		List<TestUser> list=(List<TestUser>)testUserService.getPageList(Integer.valueOf(nextPage),Integer.valueOf(pageSize));
		return JSON.toJSONString(list);
	}

}